<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<c:if test="${Role=='student' }">
<%@ include file="header_student.jsp"%>
</c:if>
<c:if test="${Role=='teacher' }">
<%@ include file="header_teacher.jsp"%>
</c:if>
<c:if test="${Role=='admin' }">
<%@ include file="header_admin.jsp"%>
</c:if>

<div class="left-sidebar">


	<div class="row-fluid">
		<div class="span2"></div>

		<div class="span10">
			<form action="/mycms/room/bookbytime" method="post">
				<div class="span2"></div>
				<div class="span8">
					<div class="btn-group" data-toggle="buttons">
						<c:forEach items="${datelist }" var="datelist">
							<c:if test="${datelist == date }">
								<label class="btn btn-primary">
									<h4>
										<input type="radio" name="date" id="date1" value="${datelist }" checked='checked' />
										${datelist }
									</h4>
								</label>
							</c:if>
							<c:if test="${datelist != date }">
								<label class="btn btn-primary">
									<h4>
										<input type="radio" name="date" id="date1" value="${datelist }" />
										${datelist }
									</h4>
								</label>
							</c:if>

						</c:forEach>
					</div>
				</div>

				<div class="widget">

					<div class="widget-header">
						<div class="span12">
							<div class="span5"></div>
							<div class="span3">

								<select class="form-control input-lg" name="time">
									<c:forEach items="${timelist }" var="timelist">
										<c:if test="${timelist.TId == timeid}">
											<option value='${timelist.TId }' selected='selected'>${timelist.start }~
												${timelist.end }</option>
										</c:if>
										<c:if test="${timelist.TId != timeid}">
											<option value='${timelist.TId }'>${timelist.start }~ ${timelist.end }</option>
										</c:if>

									</c:forEach>
								</select>
							</div>
							<div class="span4">
								<div class="row">
									<div class="span1">
										<!--  	<button type="button" class="btn btn-primary btn-lg" onclick="window.location.href='boardroombytime.jsp'">查询</button>-->
										<input type="submit" class="btn btn-primary btn-lg" value="查询" />
									</div>
									<div class="span2">&nbsp;</div>
									<div class="span2">
										<button type="button" class="btn btn-info btn-lg"
											onclick="window.location.href='/mycms/room/book'";>重置</button>
									</div>
								</div>
							</div>
						</div>
					</div>
			</form>
			<form id="roominfo" action="/mycms/room/saveroom" method="post">
				<input type="hidden" name="date" value="${date }">
				<input type="hidden" name="time" value="${timeid }">
				<input type="hidden" id="roomid" name="roomid" value="">
				<div class="widget-body">
					<table class="table table-condensed table-striped table-bordered table-hover no-margin">
						<thead>
							<tr>
								<th style="width:20%">房间号</th>
								<th style="width:20%" class="hidden-phone">容纳人数</th>
								<th style="width:10%" class="hidden-phone">是否有多媒体</th>
								<th style="width:20%" class="hidden-phone">备注</th>
								<th style="width:20%" class="hidden-phone"></th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${orderlist }" var="room">
								<tr>
									<td>${room.BId }</td>
									<td class="hidden-phone">${room.BSize }</td>
									<td class="hidden-phone"><c:if test="${room.media == 1}">
                            						有
                            					</c:if> <c:if test="${room.media == 0}">
                            						没有
                            					</c:if></td>
									<td class="hidden-phone">${room.remarks }</td>
									<td class="hidden-phone">
										<center>
											<button type="button" class="btn btn-warning" onclick="submitroom(${room.BId })">现在预约</button>
										</center>
										</center>
									</td>

								</tr>
							</c:forEach>
							<c:forEach items="${notorderlist }" var="room">
								<tr>
									<td>${room.BId }</td>
									<td class="hidden-phone">${room.BSize }</td>
									<td class="hidden-phone"><c:if test="${room.media == 1}">
                            	有
                            </c:if> <c:if test="${room.media == 0}">
                            	没有
                            </c:if></td>
									<td class="hidden-phone">${room.remarks }</td>
									<td class="hidden-phone">
										<center>
											<button type='button' class='btn btn-danger' disabled='disabled'>不可预约</button>
										</center>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</form>
		</div>
	</div>

</div>
<!--/.fluid-container-->
</div>
<script type="text/javascript">
    
    function submitroom(roomid)
    {
    	document.getElementById("roomid").value = roomid;
    	document.getElementById("roominfo").submit();
    	
    }
    
    </script>
<jsp:include page="footer.jsp"></jsp:include>
